• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Attribute error saying it must both appear in an element but dont  RSS feed

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im getting 2 errors in my xml file. I have an attribute named currency which is within the price element. The errors are telling me currency is not allowed to appear in element price but the other error is telling me it must appear in price. I currently have it in price and dont know what to do to fix this. Error code is cvc-complex-Type-4 And cvc-complex-Type-2.2. Or view code here https://codeshare.io/24Q0E4

XML:

 

Schema:

 
Saloon Keeper
Posts: 2268
290
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both of these lines have a quotation mark at the end of the element's value:
 
zach pass
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have since fixed that and changed the way i declare both brand and price but now it says i cannot put them in there.
 
Sheriff
Posts: 23968
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of the elements in your document are in the "https://Vocab1Schema.com" namespace, because that's the default namespace. But your "currency" attribute isn't, it isn't in any namespace. (The default namespace doesn't apply to attributes.) I know very little about Schema but it looks to me like it requires the "currency" attribute to be in that "https://Vocab1Schema.com" namespace as well.
 
Ron McLeod
Saloon Keeper
Posts: 2268
290
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:All of the elements in your document are in the "https://Vocab1Schema.com" namespace, because that's the default namespace. But your "currency" attribute isn't, it isn't in any namespace. (The default namespace doesn't apply to attributes.) I know very little about Schema but it looks to me like it requires the "currency" attribute to be in that "https://Vocab1Schema.com" namespace as well.


I am not an expert so these suggestions may not be the best, but should be helpful.

It looks like there are two problems:
    - you need to define a namespace for the attributes (as Paul just mentioned)
    - you need to define the type of content for the brand element


 
Ranch Hand
Posts: 718
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@op
Instead of posting here and there corrections which result in a schema still largely incorrect and would even be counter productive because you would ever in the mud and would understand the key idea behind all those construction. The thing you have to say clearly : do you mean what you write in the original xml document or that you want your attributes: not only @currency, but also @condition be forever prefixed or not (as Paul clapham's note is the pertinent one.) What do you say? After that, I can put you in the right track and can even give you a clean sheet of schema for that xml so that you can study it if you like or use it right away for practical purpose without necessarily understand all the details.
 
Get me the mayor's office! I need to tell him about this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!