Jump to content

stephen1313

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About stephen1313

  • Rank
    Newbie
  1. I would like to create an xsl file that takes XML info and displays it in HTML.XML format is:<Entry> <Author> <FirstName>joe</FirstName> <LastName>smith</LastName> </Author> <Author> <FirstName>bill</FirstName> <LastName>smith</LastName> </Author> <Author> <FirstName>dave</FirstName> <LastName>smith</LastName> </Author> <Author> <FirstName>mary</FirstName> <LastName>smith</LastName> </Author> <Title>cool writings</Title> <Booktitle>XML guideline</Booktitle> <Year>3000</Year> <Type>Journal</Type> <Topic>SEC</Topic> <Download>book1.doc</Download> </Entry>I want the output to be sorted by year (in an ordered table (decending by year and month).I would also like to have a select statement that works off of the year so I can group by year (I.E. 2010, 2009, 2008 etc.)Any help is appreciated.
  2. Is there a tool that will read my XML file and infer an XSLT file?
  3. Thanks for your help.I think I am close to having this done.Here is my code now:<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"><xs:element name="letter"> <xs:complexType> <xs:attribute name="date" type="xs:string"/> <xs:element name="to" type="xs:normalizednormalizedString"/> <xs:complexType> <xs:attribute name="first" type="xs:normalizedString"/> <xs:attribute name="last" type="xs:normalizedString"/> </xs:complexType> <xs:complexType> <xs:element name="from" type="xs:normalizedString"/> <xs:attribute name="first" type="xs:normalizedString"/> <xs:attribute name="middle" type="xs:normalizedString"/> </xs:complexType> <xs:complexType> <xs:element name="title" type="xs:string"/> <xs:element name="msg" type="xs:string"/> <xs:attribute name="paragraph" type="xs:string"/> </xs:complexType> </xs:complexType></xs:element></xs:schema>Here is my error now:Ln 6 Col 63 - s4s-elt-invalid-content.1: The content of '#AnonType_letter' is invalid. Element 'element' is invalid, misplaced, or occurs too often.If you can help, I would really appreciate it. I have to get this done so I can move on to other content.
  4. Here is an update for those of you helping me out:I have updated my code to the following:<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"><xs:element name="letter"> <xs:attribute name="date" type="xs:normalizedString"/> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:normalizednormalizedString"/> <xs:element name="first" type="xs:normalizedString"/> <xs:element name="last" type="xs:normalizedString"/> </xs:sequence> </xs:complexType> <xs:complexType> <xs:sequence> <xs:element name="from" type="xs:normalizedString"/> <xs:element name="first" type="xs:normalizedString"/> <xs:element name="middle" type="xs:normalizedString"/> </xs:sequence> </xs:complexType> <xs:complexType> <xs:sequence> <xs:element name="title" type="xs:normalizedString"/> <xs:element name="msg" type="xs:normalizedString"/> <xs:element name="paragraph" type="xs:normalizedString"/> </xs:sequence> </xs:complexType> </xs:element></xs:schema>Now I am down to only 1 error on validation of my XML file:Ln 6 Col 56 - s4s-elt-must-match.1: The content of 'letter' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: attribute.
  5. Thanks for helping with this.I feel like I am getting there. It is not quite like the DTD stuff I did where you could nest the attributes for the elements.Here is what I have now and my errors:XSD file:<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"><xs:element name="letter"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:normalizednormalizedString"/> <xs:element name="from" type="xs:normalizedString"/> <xs:element name="title" type="xs:normalizedString"/> <xs:element name="msg" type="xs:normalizedString"/> </xs:sequence> <xs:attribute name="date" type="xs:normalizedString"/> <xs:attribute name="last" type="xs:normalizedString"/> <xs:attribute name="first" type="xs:normalizedString"/> <xs:attribute name="middle" type="xs:normalizedString"/> <xs:attribute name="paragraph" type="xs:normalizedString"/> </xs:complexType> </xs:element></xs:schema>Errors:Ln 6 Col 62 - src-resolve.4.2: Error resolving component 'xs:normalizednormalizedString'. It was detected that 'xs:normalizednormalizedString' is in namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'file:///C:/XML/lettersl.xsd'. If this is the incorrect namespace, perhaps the prefix of 'xs:normalizednormalizedString' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:///C:/XML/lettersl.xsd'.Ln 13 Col 10 - cvc-type.3.1.2: Element 'from' is a simple type, so it must have no element information item [children].Ln 22 Col 9 - cvc-type.3.1.2: Element 'msg' is a simple type, so it must have no element information item [children].
  6. Ok, here are the errors I get now:Ln 12 Col 44 - s4s-elt-must-match.1: The content of 'letter' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: attribute.Ln 6 Col 62 - src-resolve.4.2: Error resolving component 'xs:normalizednormalizedString'. It was detected that 'xs:normalizednormalizedString' is in namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'file:/C:/lettersl.xsd'. If this is the incorrect namespace, perhaps the prefix of 'xs:normalizednormalizedString' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/C:/lettersl.xsd'.Ln 4 Col 54 - cvc-complex-type.3.2.2: Attribute 'date' is not allowed to appear in element 'letter'.Ln 13 Col 10 - cvc-type.3.1.2: Element 'from' is a simple type, so it must have no element information item [children].Ln 14 Col 10 - cvc-complex-type.2.4.a: Invalid content was found starting with element 'title'. One of '{heading}' is expected.Here is my updated xsd file:<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"><xs:element name="letter"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:normalizednormalizedString"/> <xs:element name="from" type="xs:normalizedString"/> <xs:element name="heading" type="xs:normalizedString"/> <xs:element name="body" type="xs:normalizedString"/> </xs:sequence> </xs:complexType> <xs:attribute name="date" type="xs:date"/> <xs:attribute name="last" type="xs:normalizedString"/> <xs:attribute name="first" type="xs:normalizedString"/> <xs:attribute name="middle" type="xs:normalizedString"/> <xs:attribute name="title" type="xs:normalizedString"/> <xs:attribute name="msg" type="xs:normalizedString"/> <xs:attribute name="paragraph" type="xs:normalizedString"/> </xs:element></xs:schema>
  7. Thanks for the help. When I did that, it really helped.I now have the following errors:Ln 5 Col 64 - s4s-elt-invalid-content.1: The content of '#AnonType_letter' is invalid. Element 'element' is invalid, misplaced, or occurs too often.Ln 10 Col 15 - s4s-elt-must-match.1: The content of 'letter' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: attribute.
  8. Learning XML and I need help.I have an xml file and I want to create a xsd file for it.I have written my file, but am experiencing errors when trying to validate the xml to my xsd.Any pointing in the right direction you can give would be appreciated.XML file:<?xml version="1.0"?><letter date="2005/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://some-where letter.xsd"> <to> <first>smith</first> <last>Lee</last> </to> <from> <first>Sylvie</first> <middle>S.</middle> </from> <title>Example</title> <msg> <paragraph> I have a question. <paragraph> Can you infer an XML Schema? </paragraph> </paragraph> </msg></letter>My XSD file:<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"><xs:element name="letter"></xs:element> <xs:complexType> <xs:element name="to" type="xs:normalizednormalizedString"/> <xs:element name="from" type="xs:normalizedString"/> <xs:element name="heading" type="xs:normalizedString"/> <xs:element name="body" type="xs:normalizedString"/> </xs:complexType><xs:attribute> <xs:attribute name="last" type="xs:normalizedString"/> <xs:attribute name="first" type="xs:normalizedString"/> <xs:attribute name="middle" type="xs:normalizedString"/> <xs:attribute name="title" type="xs:normalizedString"/> <xs:attribute name="msg" type="xs:normalizedString"/> <xs:attribute name="paragraph" type="xs:normalizedString"/></xs:attribute></xs:schema>Here are the errors I am getting:Ln 8 Col 64 - s4s-elt-invalid-content.1: The content of 'null' is invalid. Element 'element' is invalid, misplaced, or occurs too often.Ln 7 Col 18 - s4s-att-must-appear: Attribute 'name' must appear in element 'complexType'.Ln 13 Col 15 - s4s-att-must-appear: Attribute 'name' must appear in element 'attribute'.Ln 14 Col 58 - s4s-elt-must-match.1: The content of '(no name)' must match (annotation?, (simpleType?)). A problem was found starting at: attribute.
×
×
  • Create New...