|
-
Apr 20th, 2004, 04:45 AM
#1
Thread Starter
Hyperactive Member
xsd Node Question
Hey all,
is it possible to declare that all content of a node is only seen as text till that node ends?
So that an xml document like this
Code:
<Data>myText</Data>
and a document like this
Code:
<Data><myNewDoc></myNewDoc></Data>
would both be valid and could be parsed against one Schema?
Thanks,
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Apr 21st, 2004, 12:42 PM
#2
Fanatic Member
Sheesh how frustrating! I battled with that for SOOOO long! Anyway, here she is:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="data">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType mixed="true">
<xs:sequence>
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
-
Apr 22nd, 2004, 03:16 AM
#3
Thread Starter
Hyperactive Member
How did you test it?
I always get an error message saying
C:\test\test_element.xml Could not find schema information for the element 'myNewDoc'. An error occurred at file:///C:/test/test_element.xml, (2, 8).
So it validates the one with only text but not the one with another element in it.
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Apr 22nd, 2004, 03:19 AM
#4
If you want the "inner element" to be parsed as pure text, you can use a CDATA node:
Code:
<outer><![CDATA[<inner></inner>]]></outer>
The inner element won't be parsed, you'll get it as a literal string.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Apr 22nd, 2004, 03:47 AM
#5
Thread Starter
Hyperactive Member
Sorry, still the same error.
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Apr 22nd, 2004, 07:57 AM
#6
Exactly the same? Then the parser is buggy...
Which parser do you use?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Apr 22nd, 2004, 08:23 AM
#7
Thread Starter
Hyperactive Member
I am doing the validation in Microsofts BizTalk Server 2004. So it should be MSXML right?
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Apr 22nd, 2004, 10:45 AM
#8
Fanatic Member
Let me check it again. But I am pretty sure it worked.
-
Apr 22nd, 2004, 10:48 AM
#9
Fanatic Member
I used xml spy to validate the documents.
The one with just a node:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="E:\DayneO\My Documents\Business Associates\DPO Solutions\Examples\node_with_any_child.xsd">
<myNewDoc></myNewDoc>
</data>
The one with just text:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="E:\DayneO\My Documents\Business Associates\DPO Solutions\Examples\node_with_any_child.xsd">
text
</data>
-
Apr 22nd, 2004, 10:50 AM
#10
Fanatic Member
Post your xml document and schema so I can see the exact structure.
-
Apr 22nd, 2004, 11:43 AM
#11
Thread Starter
Hyperactive Member
I'll post it tomorrow, when I am back in work!
Thanx all,
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|