Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9157231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:57:49+00:00 2026-06-17T12:57:49+00:00

. Validate Online: http://xmlvalidator.new-studio.org XML Document (also displayed below) Question 1 When I uncomment

  • 0

.

Validate Online: http://xmlvalidator.new-studio.org

XML Document (also displayed below)

Question 1

When I uncomment the following line no. 4

<!ELEMENT persona (#PCDATA|(name,dob?,address*)) >

AND comment the following line no. 5

<!ELEMENT persona (name,dob?,address*) >

Why the following error shows?

  • Line 4 Column 28 : An element type is required in the declaration of element type "persona".

Here, I want that user can EITHER use parsable character string OR can write the name, dob & address tags and write the info in them.

Question 2

When I replace the encoding from "ISO-8859-1" to "utf-8", and load the page in browser (Google Chrome); it shows the following error.

error on line 2 at column 21: Encoding error

But validation is successful & OK.

Why does it show that error?
Which encoding is good?

The XML Document with embedded DTD

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE personality [
<!ELEMENT personality (persona*) >
<!-- <!ELEMENT persona (#PCDATA|(name,dob?,address*)) > -->
<!ELEMENT persona (name,dob?,address*) >
<!-- <!ELEMENT name (#PCDATA|(first_name,last_name)) > -->
<!ELEMENT name (first_name,last_name) >
<!ELEMENT first_name (#PCDATA) >
<!ELEMENT last_name (#PCDATA) >
<!ELEMENT dob (date+,month+,year+) >
<!ELEMENT date (#PCDATA) >
<!ELEMENT month (#PCDATA) >
<!ELEMENT year (#PCDATA) >
<!ELEMENT address (building,street,city,state,country,country_code) >
<!ELEMENT building (#PCDATA) >
<!ELEMENT street (#PCDATA) >
<!ELEMENT city (#PCDATA) >
<!ELEMENT state (#PCDATA) >
<!ELEMENT country (#PCDATA) >
<!ELEMENT country_code (#PCDATA) >

<!ATTLIST persona id ID #REQUIRED >
<!ATTLIST name type (string|number) "string" >
<!ATTLIST dob type (string|number) "number" >
<!ATTLIST address type (string|number) "string" >

<!ENTITY author "Miguel Pitts" >
<!ENTITY website "example.com" >
<!ENTITY email "miguelpitts4MN@teleosaurs.xyz" >
<!ENTITY copyright "Copyright © Miguel Pitts" >

]>

<?xml-stylesheet type="text/css" href="xmlstyle.css" ?>

<personality>
    <persona id="p1">
        <name type="string">
            <first_name>Miguel</first_name>
            <last_name>Pitts</last_name>
        </name>
        <dob type="number">
            <date>12</date>
            <month>02</month>
            <year>1989</year>
        </dob>
        <address type="string">
            <building>1233</building>
            <street>15</street>
            <city>NY</city>
            <state>Bangkok</state>
            <country>China</country>
            <country_code>82</country_code>
        </address>
    </persona>
</personality>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:57:51+00:00Added an answer on June 17, 2026 at 12:57 pm

    Here, I want that user can EITHER use parsable character string OR can write the name, dob & address tags and write the info in them.

    Understandable, but not allowed by the XML spec (for the reasons outlined by Nic Gibson in another SO question). Your best bet is to redesign your XML slightly; you might, for example, declare

    <!ELEMENT persona (str | (name,dob?,address*) ) >
    <!ELEMENT str (#PCDATA) >
    

    or you could declare

    <!ELEMENT persona_simple (#PCDATA) >
    <!ELEMENT persona_struct (name,dob?,address*) >
    

    Why does it show that error? Which encoding is good?

    Are those trick questions? It shows that error because it detects that the character encoding of the input cannot possibly be the character encoding declared. By “which encoding is good?” I assume you mean “which encoding should I name in my document’s encoding declaration?” — the answer to that question is “the encoding that you use in the document”. If you’re asking the question, I guess you aren’t sure which encoding your document actually uses; judging from the behavior you describe, it looks as if the document is in fact not using UTF-8 but ISO 8859 part 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Validate Online: http://xmlvalidator.new-studio.org XML Document (also displayed below) Question 1 Why the following 6
I have a schema similar to the following... <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:element
I have an xml and xsd file that both validate correctly (tested at http://xsdvalidation.utilities-online.info/
I'm trying to validate my XML document against my XML schema. This is my
I have this schema: <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema> <xs:simpleType name=errorType> <xs:restriction base=xs:decimal> <xs:totalDigits
I'm trying to validate a simple XML file against an XML schema using the
Hi I've got some XML that won't validate. I've narrowed down the problem to
I am trying to validate a few XML files and I'm failing due to
I have the following PHP code which simply grabs a URL behind HTTP-Basic authentication
I'm working on an online booking site (airline) and I want to validate if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.