Normal Topic XML Question (Read 550 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
XML Question
May 26th, 2009 at 2:47pm
Print Post Print Post  
While running the WalkTheDoc Subroutine on any XML file, I am getting several <text> nodes. Why is that?

Code
Select All
var vHandle as Int


subroutine WalkTheDoc(vh as int)
var vNodeName as string
var vNodeValue as String

var vFlag as int
vFlag = 1
while(vFlag = 1)
{


	vNodeName = @XMLNodeName(vh)
	//vNodeValue = @XMLNodeValue (vh)
	//WriteLN (vNodeName + " = " + vNodeValue)
	WriteLn(vNodeName)
	if(@XMLChild(vh) = 1)
	{
	WalkTheDoc(vh)
	vFlag = @XMLParent(vh)
	}
    vFlag = @XMLNext(vh)
}
end subroutine



vHandle = @XMLParseFile ("output.xml")

If vHandle <> -1 then
	{
		WalktheDoc (vHandle)

	}
	XMLDeleteDoc (vHandle)


 



If I create XML file using @XMLNewDoc ( ) command, it is missing the first line -

<?xml version="1.0" encoding="ISO-8859-1"?>

How do I place that?

I have just started working with XML. The Schema requires to make XML file several gererations deep. How do I accomplish it using whatever available in Sesame2.1?

I have just tried to present a small part of schema to show that it goes several generations deep:

</xs:element>
    <xs:element name="WrittenDate" minOccurs="1" maxOccurs="1" type="DateType" />
    <xs:element name="LastFillDate" minOccurs="0" maxOccurs="1" type="DateType" />
      <xs:element name="Diagnosis" minOccurs="0" maxOccurs="2">
         <xs:complexType>
           <xs:sequence>
               <xs:element name="ClinicalInformationQualifier" minOccurs="1" maxOccurs="1">
                   <xs:simpleType>
                     <xs:restriction base="xs:string">
                         <xs:pattern value="PrescriberSupplied|PharmacyInferred" />
                     </xs:restriction>
                   </xs:simpleType>
               </xs:element>
                      <xs:element name="Primary" minOccurs="1" maxOccurs="1" type="DiagnosisType" />
                       <xs:element name="Secondary" minOccurs="0" maxOccurs="1" type="DiagnosisType" />
           </xs:sequence>
         </xs:complexType>
  </xs:element>

I am really trying to put everything together including the presentation given by Erika on XML. The task seems daunting!

  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: XML Question
Reply #1 - May 27th, 2009 at 2:10pm
Print Post Print Post  
Learning more about Schema and see that it appears multi-generations deep but it is not. I believe, to write a XML file, I will have to use FileWrite ( ) and to Parse the xml files, I will need to use XML commands of sbasic including WalkTheDoc ( ) Subroutine.  I might have to use external program to validate the xml file against the schema. Still looking for some clarity and courage to jumpstart the project. Your comments and suggestions will be very much appreciated. Thanks.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: XML Question
Reply #2 - May 27th, 2009 at 2:13pm
Print Post Print Post  
If you are trying to create an XML file, just use File I/O like the sample file from my presentation does. It's much more simple and direct than building and dumping a live XML tree.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged